/*   
 * Copyright 2011-2012 the original author or authors.   
 *   
 * Licensed under the Apache License, Version 2.0 (the "License");   
 * you may not use this file except in compliance with the License.   
 * You may obtain a copy of the License at   
 *   
 *      http://www.apache.org/licenses/LICENSE-2.0   
 *   
 * Unless required by applicable law or agreed to in writing, software   
 * distributed under the License is distributed on an "AS IS" BASIS,   
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   
 * See the License for the specific language governing permissions and   
 * limitations under the License.   
 */
package code.google.com.p.antigovframe.sample

import org.junit.*
import org.orda.sample.dao.*;
import org.hibernate.SessionFactory
import org.hibernate.Session

import code.google.com.p.antigovframe.sample.dao.TaskDAO;
import code.google.com.p.antigovframe.sample.dao.TaskDAOImpl;
import code.google.com.p.antigovframe.sample.domain.Task;
/**
 * @author Jacob Lee
 * @since 2012. 8. 10.
 * 
 */
class TaskDAOTest extends BaseDAOTest<TaskDAO> {
	private TaskDAO dao;
	
	void setUp() { 
	
		dao=new TaskDAOImpl();
		setRealSession();
		dao.sessionFactory =factory;
		 
	}
	
	
	//TDD: Saving DAO
	void testSaving() {
//		def daoStub=new StubFor(TaskDAOImpl);
//		def entity=new Expando(taksNo:"TA-12345", title:"Task must be editable!")
//		daoStub.demand.persistOrMerge {
//			entity
//		}
		
		def task1=new Task("System", "2012-07-13");
		task1.title="Task must be editable!"
		task1.body="The Task has a life cycle. But the status of a task changes is edited by user."
		task1.taskNo="TA-12345"
		task1.assignedTo="Tomy"
		task1.status="opened"
		
//		dao.persistOrMerge(task1);
//		daoStub.use{
//			daoStub.persistOrMerge(task1);
//		}
	}
}
